from enum import Enum

class Player(Enum):
    BLACK = 'black'
    WHITE = 'white'
    EMPTY = None

class PatternConstants(Enum):
    PLAYER = 'player'
    OPPONENT = 'opponent'
    EMPTY = 'empty'
    EDGE = 'edge'

class BoardConfig:
    SIZE = 15
    CELL_SIZE = 30
    MARGIN = 40
    CENTER = SIZE // 2

# 棋型评分标准
PATTERN_SCORES = [
    ([PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.PLAYER], 100000, 0),   # 连五
    ([PatternConstants.EMPTY, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.EMPTY], 10000, 1),  # 活四
    ([PatternConstants.EDGE, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.EMPTY], 5000, 1),    # 冲四
    ([PatternConstants.EMPTY, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.EDGE], 5000, 1),    # 冲四
    ([PatternConstants.OPPONENT, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.EMPTY], 5000, 1),# 冲四
    ([PatternConstants.EMPTY, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.OPPONENT], 5000, 1),# 冲四
    ([PatternConstants.EMPTY, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.EMPTY, PatternConstants.EMPTY], 1500, 2),    # 活三
    ([PatternConstants.PLAYER, PatternConstants.EMPTY, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.EMPTY], 1200, 2),   # 跳活三
    ([PatternConstants.EMPTY, PatternConstants.EMPTY, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.EMPTY], 1000, 2),    # 活三
    ([PatternConstants.EMPTY, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.EDGE, PatternConstants.EMPTY], 500, 2),      # 冲三
    ([PatternConstants.EMPTY, PatternConstants.EDGE, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.EMPTY], 500, 2),      # 冲三
    ([PatternConstants.OPPONENT, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.EMPTY, PatternConstants.EMPTY], 500, 2),  # 冲三
    ([PatternConstants.EMPTY, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.EMPTY, PatternConstants.EMPTY, PatternConstants.EMPTY], 200, 3),      # 活二
    ([PatternConstants.PLAYER, PatternConstants.EMPTY, PatternConstants.PLAYER, PatternConstants.EMPTY, PatternConstants.PLAYER, PatternConstants.EMPTY], 180, 3),     # 跳二
    ([PatternConstants.EMPTY, PatternConstants.EMPTY, PatternConstants.PLAYER, PatternConstants.PLAYER, PatternConstants.EMPTY, PatternConstants.EMPTY], 100, 3),      # 活二
    ([PatternConstants.EMPTY, PatternConstants.PLAYER, PatternConstants.EMPTY, PatternConstants.PLAYER, PatternConstants.EMPTY, PatternConstants.EMPTY], 80, 4),       # 跳二
    ([PatternConstants.PLAYER, PatternConstants.EMPTY, PatternConstants.PLAYER, PatternConstants.EMPTY, PatternConstants.EMPTY, PatternConstants.EMPTY], 80, 4),       # 跳二
]

# AI难度设置
class Difficulty(Enum):
    EASY = 'easy'
    MEDIUM = 'medium'
    HARD = 'hard'

# 评分权重配置
SCORE_WEIGHTS = {
    'defense': 1.4,
    'attack': 1.1,
    'ai_score': 1.1,
    'player_score': 1.1
}